//1.引入 request
import request from "../utils/request";
/*
注意： get方式 使用 params
post 方式 使用 data
*/

//获取 商品数据的接口
//params 参数 供给 查询和分页使用
export function fetchProductList(params) {
	return request({
		url: "product_list",
		method: "get",
		params: params,
	});
}

//获取 商品分类的列表
export function fetchProductCateList(params) {
	return request({
		url: "get_product_category",
		methods: "get",
		params: params,
	});
}

//获取商品品牌
export function fetchBrandList(params) {
	return request({
		url: "get_product_brand",
		methods: "get",
		params: params,
	});
}
//品牌管理获取列表
export function fetchBrandPag(params) {
	return request({
		url: "get_product_brand_pag",
		method: "get",
		params: params,
	});
}
//品牌添加
export function addBrand(data) {
	return request({
		url: "create_product_brand",
		method: "post",
		data: data,
	});
}
//获取一条品牌管理信息
export function fetchBrandOne(params) {
	return request({
		url: "brand_one",
		method: "get",
		params: params,
	});
}
//品牌修改
export function editBrand(data) {
	return request({
		url: "update_product_brand",
		method: "post",
		data: data,
	});
}
//品牌删除
export function deleteBrand(params) {
	return request({
		url: "delete_product_brand",
		method: "get",
		params: params,
	});
}
//商品类型列表
export function fetchProductAttr(params) {
	return request({
		url: "get_product_attr",
		methods: "get",
		params: params,
	});
}

//添加商品信息
export function addProduct(data) {
	return request({
		url: "create_product",
		method: "post",
		data: data,
	});
}
//修改商品信息
export function updateProduct(data) {
	return request({
		url: "update_product",
		method: "post",
		data: data,
	});
}
//获取单条商品数据
export function fetchOneProduct(params) {
	return request({
		url: "product_one",
		method: "get",
		params: params,
	});
}
//通过商品的id获取上级分类节点数据
export function fetchParentProductCate(params) {
	return request({
		url: "get_parent_id",
		method: "get",
		params: params,
	});
}
//删除商品信息
export function deleteProduct(params) {
	return request({
		url: "delete_status",
		method: "get",
		params: params,
	});
}

//获取带分页的分类数据 //get_product_category_list/0
export function fetchProductCatePage(params, id) {
	return request({
		url: "get_product_category_list/" + id,
		method: "get",
		params: params,
	});
}
//获取商品分类(单例)
export function fetchProductCateOne(params) {
	return request({
		url: "product_cate_one",
		method: "get",
		params: params,
	});
}
//添加商品分类
export function addProductCate(data) {
	return request({
		url: "create_product_cate",
		method: "post",
		data: data,
	});
}
//修改分类信息
export function editProductCate(data) {
	return request({
		url: "update_product_cate",
		method: "post",
		data: data,
	});
}
//删除商品分类
export function deleteProductCate(data) {
	return request({
		url: "delete_category",
		method: "post",
		data: data,
	});
}

//添加商品类型
export function addProductAttr(data) {
	return request({
		url: "create_product_attr",
		method: "post",
		data: data,
	});
}
//修改商品类型
export function updateProductAttr(data) {
	return request({
		url: "update_product_attr",
		method: "post",
		data: data,
	});
}
//删除商品类型
export function deleteProductAttr(params) {
	return request({
		url: "delete_product_attr",
		method: "get",
		params: params,
	});
}

